﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HsCmpScm
{
    public partial class Site : System.Web.UI.MasterPage
    {
        static ScmConfiguration Configure = new ScmConfiguration();
        Boolean CheckConfigXmlFile;
        Boolean CheckDbConfig;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Configure.CheckConfigXmlFile() == false)
            {
                this.CheckConfigXmlFile = false;

                Label_ErrorMsg.Text = "<font color=\"#ff0000\">配置文件检查不通过...";
                Label_ErrorMsg.Text += "<br />" + Configure.ErrorMsg + "</font>";
            }
            else
            {
                //设置PageTitle
                Page.Header.Title = Configure.GetPageTitle();

                Label_ComanyName.Text = Configure.GetCompanyName();
                Label_DepName.Text = Configure.GetDepName();

                this.CheckConfigXmlFile = true;
                //Label_ErrorMsg.Text = "<font color=\"#008000\">配置文件检查通过...</font>";                
            }
            if (CheckConfigXmlFile)
            {
                if (Configure.CheckDataBaseConfig() == false)
                {
                    Label_ErrorMsg.Text += "<br /><font color=\"#ff0000\">检查数据库（SQL Server）配置不通过...";
                    Label_ErrorMsg.Text += "<br />" + Configure.ErrorMsg + "</font>";
                }
                else
                {
                    this.CheckDbConfig = true;

                    //Label_ErrorMsg.Text += "<br />";
                    //Label_ErrorMsg.Text += "<font color=\"#008000\">检查数据库（SQL Server）配置通过...</font>";
                }
            }
            if (CheckDbConfig)
            {
                Label_ErrorMsg.Text = "<font color=\"#008000\">测试通过...</font>";
            }
        }
    }
}